﻿using MediatR;
using T.Vehicleservice.API.Application.Command.ExpenseCommand;
using T.Vehicleservice.API.Application.Command.MaintenanceRecordCommand;
using T.Vehicleservice.Repository.ImpI;
using T.Vehicleservice.Repository.Interface;

namespace T.Vehicleservice.API.Application.CommandHandlers.ExpenseCommanHandler
{
    public class ExpenseCreateCommandHandler : IRequestHandler<ExpenseCreateCommand, int>
    {
        IExpenseRecordRepository expenseRecordRepository;

        public ExpenseCreateCommandHandler(IExpenseRecordRepository expenseRecordRepository)
        {
            this.expenseRecordRepository = expenseRecordRepository;
        }

        public async Task<int> Handle(ExpenseCreateCommand request, CancellationToken cancellationToken)
        {
            return await expenseRecordRepository.AddAsync(request);
        }
    }
}
